package com.cdn.auth.context;

import com.cdn.auth.user.UserDetails;
import com.cdn.auth.user.UserInfo;

/**
 * 蔡定努
 * 2024/06/28 17:01
 */
public class UserContext {

    private static final ThreadLocal<UserInfo> USER_DETAILS_THREAD_LOCAL = new InheritableThreadLocal<>();


    /**
     * @author 蔡定努
     */
    public static void set(UserInfo userInfo) {
        USER_DETAILS_THREAD_LOCAL.set(userInfo);
    }


    public static UserInfo get() {
        return USER_DETAILS_THREAD_LOCAL.get();
    }


    public static void remove() {
        USER_DETAILS_THREAD_LOCAL.remove();
    }

}
